import request from '@/utils/request'

// 查询所有角色/park/sys/role
export function getRoleListAPI() {
  return request({
    url: '/park/sys/role'
  })
}

// 查询所有功能权限/park/sys/permision/all/tree
export function getTreeListAPI() {
  return request({
    url: '/park/sys/permision/all/tree'
  })
}

// 查询当前角色详情-权限和分配人数/park/sys/role/{roleId}
export function getRoleDetailAPI(roleId) {
  return request({
    url: '/park/sys/role/' + roleId
  })
}

// 查询角色关联的用户列表/park/sys/roleUser/{roleId}
export function getRoleUserListAPI(roleId) {
  return request({
    url: '/park/sys/roleUser/' + roleId
  })
}

// 删除角色
export function delRoleUserAPI(roleId) {
  return request({
    url: `/park/sys/role/${roleId}`,
    method: 'DELETE'
  })
}

// 添加角色
export function createRoleUserAPI(data) {
  return request({
    url: `/park/sys/role`,
    method: 'POST',
    data
  })
}

// 修改角色
export function updateRoleUserAPI(data) {
  return request({
    url: `/park/sys/role`,
    method: 'PUT',
    data
  })
}
